package com.zh.rent.util;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class JsonResult {
    private int status;
    private String msg;
    private Object data;
    /*返回成功*/
    public final static JsonResult OK(Object data) {
        return new JsonResult(RespStatus.SUCCESS.type, RespStatus.SUCCESS.value, data);
    }

    public final static JsonResult OK() {
        return new JsonResult(RespStatus.SUCCESS.type, RespStatus.SUCCESS.value, null);
    }

    public static JsonResult ERROR(Object data) {
        return new JsonResult(RespStatus.ERROR.type, RespStatus.ERROR.value, data);
    }
}
